package com.dc.service.impl;

import com.dc.dao.ShopOrderDao;
import com.dc.em.ErrorMessageEnum;
import com.dc.model.ShopOrder;
import com.dc.service.ShopOrderService;
import com.dc.vo.BaseModel;
import com.dc.vo.BusinessException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.concurrent.ExecutionException;

@Service
public class ShopOrderServiceImpl implements ShopOrderService {
    @Autowired
    ShopOrderDao shopOrderDao;
    public BaseModel addShopOrder(ShopOrder shopOrder,BaseModel baseModel) throws Exception {
        int result = shopOrderDao.insertShopOrder(shopOrder);
        if(result <= 0){
            throw new BusinessException(ErrorMessageEnum.ADD_SHOPORDER_ERROR);
        }
        baseModel.setResultCode(0);
        baseModel.setMessage("新增"+result+"条订单成功");
        return baseModel;
    }
}
